﻿using System;
using Syncfusion.Pdf.Parsing;

namespace PdfSdk.Pdf
{
    public class PdfStringWrapper : ObjectWrapper, IPdfPrimitiveWrapper
    {
        private static Type s_type;

        public static PdfStringWrapper Create(string value)
        {
            s_type ??= Type.GetType($"Syncfusion.Pdf.Primitives.PdfString, {typeof(PdfLoadedDocument).Assembly.FullName}");
            var obj = CreateInstance(s_type, value);
            return new PdfStringWrapper(obj);
        }

        public PdfStringWrapper(object obj) : base(obj)
        {
        }

        public string Value
        {
            get => GetPropertyValue() as string;
            set => SetPropertyValue(value);
        }

        public byte[] Bytes
        {
            get => GetPropertyValue() as byte[];
            set => SetPropertyValue(value);
        }
    }
}
